<?php

/**
 * wx component_verify_ticket model
 * @author perry
 */

namespace Home\Model;

use Think\Model;

class ComponentVerifyTicketModel extends Model {


    /**
     * 初始化
     */
    function _initialize() {
        $this->tableName = 'weixin_cvt';
    }
    
    function getLatest(){
    	$u = $this->order('id desc')->find();
    	return $u?$u['ticket']:false;
    }
    
    function addOne($data){
    	// $u = $this->getLatest();
    	// if($u!=$data['ComponentVerifyTicket']){
            $newDatas['create_time']=$data['CreateTime'];
            $newDatas['ticket']=$data['ComponentVerifyTicket'];
    		$this->add($newDatas);
            $u=$newDatas['ticket'];
    	// }
    	return $u;
    }

    

}
